/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.myapp.struts.controleur;

import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

/**
 *
 * @author jackson
 */
public class ConnexionForm extends ActionForm {
    
    private String num;
    private String password;
    private String statut;

    public String getNum() {
        return num;
    }

    public void setNum(String num) {
        this.num = num;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getStatut() {
        return statut;
    }

    public void setStatut(String statut) {
        this.statut = statut;
    }
     
    @Override
    public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
        ActionErrors errors = new ActionErrors();
        
        if (num == null || num.length() == 0) {
            errors.add("num", new ActionMessage("errors.num.required"));
            // TODO: add 'error.name.required' key to your resources
        }
        if(password==null || password.length() == 0){
            errors.add("password", new ActionMessage("errors.password.required"));
        }
        return errors;
    }
    
}
